<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>AjaxDEMO01</title>
</head>
<body>
    <script>
        //创建ajax核心对象
        var xhttp;
        if (window.XMLHttpRequest){
            xhttp=new XMLHttpRequest();
        }else {
            // code for IE6, IE5
            xhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        // 建立连接
        xhttp.open("GET","/JMS2301_03_javaWeb_war/ajaxDemo01")
        //发送请求
        xhttp.send();
        //获取响应
        xhttp.onreadystatechange=function (){
            if (this.readyState== 4 && this.status == 200){
                //通过this.responseText可以获取到来自服务器响应的数据
                alert(this.responseText);
            }
        }
    </script>
</body>
</html>